package org.examples;

import java.io.InputStream;

import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.entity.mime.MultipartEntityBuilder;
import org.apache.hc.client5.http.entity.mime.StringBody;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.core5.http.ContentType;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.http.message.StatusLine;

import lombok.extern.slf4j.Slf4j;
import reactor.core.publisher.Flux;
import reactor.netty.ByteBufFlux;
import reactor.netty.http.client.HttpClient;
@Slf4j
public class ReactorHello {
  public static void main(final String[] args) throws Exception {
    log.info("ReactorHello.main");
    HttpClient.create()             // Prepares an HTTP client ready for configuration
        .baseUrl("httpbin.org")
        // client should connect
        .post()               // Specifies that POST method will be used
        .uri("/post")   // Specifies the path
        .send(ByteBufFlux.fromString(Flux.just("Hello")))  // Sends the request body
        .responseContent()    // Receives the response body
        .aggregate()
        .asString()
        .log("http-client")
        .block();
  }
}
